package com.java.code.web.controller;

import com.java.code.aop.ExcuteTimeAnnotation;
import com.java.code.aop.LogAnnotation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * @author weichuanyuan
 * @version 1.0
 * @date 2021/9/24 16:51
 */
@RestController
@RequestMapping("/hello")
@ExcuteTimeAnnotation
@LogAnnotation
public class HelloController {

    //表单提交
    @RequestMapping("/form")
    public String form(FormParam param) {
        System.out.println(param);
        return "success";
    }

    @RequestMapping("/test")
    public String test(@RequestParam(value = "name", defaultValue = "") String name) {
        return "hello" + name;
    }

    public class FormParam {
        private String unitCode;
        private String password;
        private MultipartFile[] dataFile;

        public String getUnitCode() {
            return unitCode;
        }

        public void setUnitCode(String unitCode) {
            this.unitCode = unitCode;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public MultipartFile[] getDataFile() {
            return dataFile;
        }

        public void setDataFile(MultipartFile[] dataFile) {
            this.dataFile = dataFile;
        }
    }
}
